package com.study_online.mapper;

import com.study_online.domain.ForumType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ForumTypeMapper {

    @Select("SELECT * FROM forum_fatherpost_type")
    @Results(
            {
                    @Result(column = "postTypeId",property = "postTypeId"),
                    @Result(column = "postTypeName",property = "postTypeName"),
                    @Result(
                            property = "forumList",
                            column = "postTypeId",
                            javaType = List.class,
                            many = @Many(select = "com.study_online.mapper.ForumMapper.findForumByPostTypeId")
                    )
            }
    )
    List<ForumType> findAllForumByType();
}
